C++ Print a Sentence

03-11-17 Course- CPP

Code



#include <iostream>
using namespace std;

int main() {
    cout << "C++ Programming.";
    return 0;
}

Output


C++ Programming.

Every C++ program starts from main() function. The cout is the standard output stream which normally flows data to the screen (can be redirected to other output devices) which displays C++ Programming.

Here is another proper way to perform this task without defining using namespace std; before main() function.


#include <iostream>

int main() {
    std::cout << "C++ Programming.";
    return 0;
}